= stylesheet_link_tag  "card_style", :media => "all"

%header
  #nav
    = link_to(t(:new_game), {:controller => "game", :action => "new"}, :class=>"btn left")

    %div{:style => "float:right;padding: 5px"}
      %li
        = link_to('Рус', {:controller => "game", :action => "index", :locale=>"ru"},  :rel => "tooltip", :title => "Руский")
      %li
        = link_to('Укр', {:controller => "game", :action => "index", :locale=>"ua"}, :rel => "tooltip", :title =>"Українська мова")
      %li
        = link_to('Eng', {:controller => "game", :action => "index", :locale=>"en"}, :rel => "tooltip", :title =>"English")
      %li
        = link_to(t(:logout), {:controller => "access", :action => "logout"}, :style=>"color:silver" , :rel => "tooltip", :title =>"Выйти")


%table.main_tbl
  %tr
    %td{:colspan => "3", :align=>"center"}
      - unless @opponent.empty?
        %div{:style => "position:relative;height: 180px;width:120px"}
          %div{:style => "position: absolute;"}
            = image_tag("back.png")
          %div{:style => "position: absolute; top:55px; left:45px;"}
            %h2.card_count
              #{@opponent.count}

  %tr
    %td
      .board
        .card_in
          - @table.source.select.each_with_index{|_, i| i.even? }.each do |card|
            = image_tag(card.image)
        .card_on
          - @table.source.select.each_with_index{|_, i| i.odd? }.each do |card|
            = image_tag(card.image)
    %td.field_koloda
      - unless @deck.empty?
        .koloda_div
          .trump
            = image_tag(@trump.image)
          - if @deck.count > 1
            .koloda
              = image_tag("back.png")
              %div{:style => "position: absolute; top:55px; left:45px;"}
                %h2.card_count
                  #{@deck.count}
  %tr
    %td{:colspan => "3"}
      .btn-group
        = link_to_if(@state == 'rebound', t(:rebound), {:controller => "game", :action => "rebound"}, :class => "btn", :rel => "tooltip", :title => t(:rebound_hint))
        = link_to_if(@state == 'get_all', t(:get_all), {:controller => "game", :action => "get_all"}, :class => "btn", :rel => "tooltip", :title => t(:get_all_hint))
        = link_to_if(@state == 'go_on', t(:go_on), {:controller => "game", :action => "goOn"}, :class => "btn", :rel => "tooltip", :title => t(:go_on_hint))
  %tr
    %td{:colspan => "3"}
      - if @state ==  'game_over'
        .alert.alert-info
          %small
            = @hint_message
      - else
        = @hint_message
  %tr
    %td{:colspan => "3"}
      - @gamer.source.each do |card|
        = link_to_if card.enabled?, image_tag(card.image, :border => 0), {:controller => "game", :action => "move", :card => card.serialize} do
          = image_tag(card.image, :class => "disabled")
